use "gles_ccs_data.dta", clear

egen party = group(partei), label
egen year = group(Election), label
egen mand = group(mandate), label
egen glauben = group(religion), label

gen ban_homo_3 = .
replace ban_homo_3 = 1 if top_banhomo == 1 | top_banhomo == 2
replace ban_homo_3 = 2 if top_banhomo == 3
replace ban_homo_3 = 3 if top_banhomo == 4 | top_banhomo == 5

gen ban_abortion_3 = .
replace ban_abortion_3 = 1 if top_schwanger == 1 | top_schwanger == 2
replace ban_abortion_3 = 2 if top_schwanger == 3
replace ban_abortion_3 = 3 if top_schwanger == 4 | top_schwanger == 5


ologit ban_homo_3 i.party c.left_right i.east i.female i.gewaehlt c.age i.mand i.glauben if Election == "2013", robust
margins party, post saving("m13.dta", replace)
est store m13
ologit ban_homo_3 i.party c.left_right i.east i.female i.gewaehlt c.age i.mand i.glauben if Election == "2017", robust
margins party, post saving("m17.dta", replace)
est store m17
ologit ban_homo_3 i.party c.left_right i.east i.female i.gewaehlt c.age i.mand i.glauben if Election == "2021", robust
margins party, post saving("m21.dta", replace)
est store m21



ologit ban_abortion_3 i.party c.left_right i.east i.female i.gewaehlt c.age i.mand i.glauben if Election == "2013", robust
margins party, post saving("m13b.dta", replace)
est store m13b
ologit ban_abortion_3 i.party c.left_right i.east i.female i.gewaehlt c.age i.mand i.glauben if Election == "2017", robust
margins party, post saving("m17b.dta", replace)
est store m17b
ologit ban_abortion_3 i.party c.left_right i.east i.female i.gewaehlt c.age i.mand i.glauben if Election == "2021", robust
margins party, post saving("m21b.dta", replace)
est store m21b

